package android.team.app.ui.missatoll;

import android.os.Bundle;
import android.team.app.R;
import android.team.app.ui.BaseActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;

public class PersonalInformationActivity extends BaseActivity{
	private Spinner spState, spGender;
	private EditText edFirstName, edLastName, edMiddleInital,
	edCity, edZipcode, edAddress, edEmail, edPhone1, edPhone2, edPhone3, edPhone4;
	
	private CheckBox cbCheckMail;
	private ImageButton imgBtNext;
	
	private String gender, state;
	private boolean ischeckMail = false;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.personal_information_activity);
		
		loadUI();
		
		titleHeader.setText(getString(R.string.personal_information));
		
		loadSpecialUI();
	}
	
	private void loadSpecialUI(){
		spGender = (Spinner)findViewById(R.id.spinnerGender);
		spGender.setAdapter(new ArrayAdapter<String>(
				baseActivity, 
				android.R.layout.simple_spinner_item, 
				getResources().getStringArray(R.array.title)));
		spGender.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,	int pos, long id) {
				gender = parent.getItemAtPosition(pos).toString();
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				gender = "Mr";
			}
		});
		
		
		spState = (Spinner)findViewById(R.id.spState);
		spState.setAdapter(new ArrayAdapter<String>(
				baseActivity, android.R.layout.simple_spinner_item, 
				getResources().getStringArray(R.array.states)));
		spState.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view,	int pos, long id) {
				state = parent.getItemAtPosition(pos).toString();
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				state = "AK";
			}
		});
		
		edFirstName = (EditText)findViewById(R.id.edFirstName);
		edLastName = (EditText)findViewById(R.id.edLastName);
		edMiddleInital = (EditText)findViewById(R.id.edMiddleInital);
		edAddress = (EditText)findViewById(R.id.edAddress);
		edCity = (EditText)findViewById(R.id.edCity);
		edZipcode = (EditText)findViewById(R.id.edZipcode);
		edEmail = (EditText)findViewById(R.id.edEMail);
		
		edPhone1 = (EditText)findViewById(R.id.edPhone1);
		edPhone2 = (EditText)findViewById(R.id.edPhone2);
		edPhone3 = (EditText)findViewById(R.id.edPhone3);
		edPhone4 = (EditText)findViewById(R.id.edPhone4);
		
		cbCheckMail = (CheckBox)findViewById(R.id.cbEmail);
		imgBtNext = (ImageButton)findViewById(R.id.btNext);
	}
    OnClickListener onClickNext=new OnClickListener() {
	OnCheckedChangeListener changeListener=new OnCheckedChangeListener() {
		
		@Override
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			ischeckMail=isChecked;
			
		}
	};
/*	OnItemClickListener selecStatus =new OnItemSelectedListener() {

		@Override
		public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onNothingSelected(AdapterView<?> arg0) {
			// TODO Auto-generated method stub
			
		}
	};*/
	@Override
	public void onClick(View v) {
		//tai day kiem tra tat ca dau vao
		//neu du lieu ok .......se luu va chuyen sang giao dien khac
		
	}
};

}
